package com.ycy.create;

import com.ycy.BaseTest;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.Process;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.repository.Deployment;
import org.junit.Test;

public class BpmnModelCreateDemo extends BaseTest {

  @Test
  public void create() {

    Process process = new Process();
    process.setId("key");
    process.setName("key");

    BpmnModel bpmnModel = new BpmnModel();
    bpmnModel.addProcess(process);

    // 部署流程
    RepositoryService repositoryService = processEngine.getRepositoryService();
    Deployment deployment = repositoryService.createDeployment()
            .addBpmnModel("key" + ".bpmn20.xml", bpmnModel).deploy();
    System.out.println(deployment);

  }

}
